package com.example.mongodb.mongodb.config;

import com.rabbitmq.client.ConnectionFactory;
import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.connection.Connection;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 基于注解整合RabbitMQ
 */
@Configuration
public class RabbitMqConfig {


    @Bean
    public Queue queue1(){
        Queue queue = new Queue("myQueue");
        return queue;
    }

    @Bean
    public Exchange exchange1(){
        return new DirectExchange("myEx",true,false,null);
    }


    @Bean
    public Binding binding1(){
        return new Binding("myQueue",Binding.DestinationType.QUEUE,"myEx","direct.biz.ex",null);

    }


}
